#ifndef _TaskQueue_H_
#define _TaskQueue_H_

#include "Condition.hpp"
#include "MutexLock.hpp"
#include <queue>
#include <functional>
using std::queue;

namespace wd{


class MutexLock;
class Condition;
class Task;

class TaskQueue{
friend class ThreadPool;
using Elemtype = std::function<void()>;

public:
    TaskQueue(int);
    ~TaskQueue();

    bool empty();
    bool full();
    void push(Elemtype &&);
    Elemtype pop();
private:
    void wakeup();

private:
    queue<Elemtype> _que;
    int _queSize;
    MutexLock _mutex;
    Condition _notFull;
    Condition _notEmpty;
    bool _flag;
};

}
#endif

